package org.zoomdev.zoom.validator.impl;

import org.zoomdev.zoom.validator.Validator;

public class NotEmptyValidator implements Validator {

    private final String message;

    public NotEmptyValidator(String message) {
        this.message = message;
    }

    @Override
    public boolean isValid(Object value) {
        if (value instanceof CharSequence) {
            return ((CharSequence) value).length() > 0;
        }
        return true; // 非集合类型由其他验证器处理
    }

    @Override
    public String getMessage() {
        return message;
    }


}